package cn.hxth.dubbo.customer.controller;

import cn.hxth.api.model.ProductSpec;
import cn.hxth.api.service.IProductSpecService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pages/spec/")
public class ProductSpecController {
    @Resource
    private IProductSpecService productSpecService ;
    @RequestMapping("insertProductSpec")
    public  boolean insertProductSpec(ProductSpec spec) {
        return  this.productSpecService.insertProductSpec(spec) ;
    }
    @RequestMapping("deleteProductSpec")
    public  boolean deleteProductSpec(int sid,int nid){
        return  this.productSpecService.deleteProductSpec(sid,nid) ;
    }
    @RequestMapping("findAll")
    public List<ProductSpec> findAll(int nid) {
        return this.productSpecService.findAll(nid) ;
    }
    @ResponseBody
    @RequestMapping("getProductSpecForMq")
    // 获取商品规格单个信息(用于mq)
    public ProductSpec getProductSpecForMq(int sid) {
        return this.productSpecService.getProductSpec(sid) ;
    }
}
